/* Copyright (c) 2016-2020 Enfry Ltd. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Enfry. 
 * You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the agreements
 * you entered into with Enfry.
 */
package com.enfry.validation.config;

import java.util.ArrayList;
import java.util.List;

import com.enfry.validation.config.Field;

/**
 * 验证组
 * @Title com.enfry.validation.config.Group
 * @author liulei
 * @date 2016年7月22日
 */
public class Group {
    /**
     * 验证组名称
     */
    private String name;
    /**
     * 验证字段
     */
    private List<Field> fields;
    /**
     * 允许验证数据组为空
     */
    private boolean allowNull;

    /**
     * 添加字段，暂时不处理去重
     *
     * @param field 字段对象
     */
    public void addField(Field field) {
        this.fields.add(field);
    }

    public Group() {
        // TODO Auto-generated constructor stub
        this.fields = new ArrayList<Field>();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Field> getFields() {
        return fields;
    }

    public void setFields(List<Field> fields) {
        this.fields = fields;
    }

    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return "[ name=" + name + ",fields=" + fields + "]";
    }

    public boolean isAllowNull() {
        return allowNull;
    }

    public void setAllowNull(boolean allowNull) {
        this.allowNull = allowNull;
    }


}
